Repository navigation
fix(wasm): accept unpadded WABT section rows - #1963
Merged
Merged
Conversation
WABT 1.0.42 right-aligns section names in a nine-column field. DataCount fills that field, so its objdump row has no leading whitespace. Accept that legal row. Header recognition, the required field shape, and section range checks still reject malformed output. Fixes morluto#1956
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Assert admitted soft-float ABI metadata and its committed storage policy through the public target resolver, retain FP64 rejection, and point the curated Windows lane at the moved filesystem reconstruction tests. Validation: reproduced all four prior failures; 97 focused tests and check:ci pass. Native Windows and real Ghidra execution were not performed locally.
3 tasks done
This was referenced Oct 11, 2026
10 tasks done
This was referenced Oct 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1956. Valid WebAssembly modules that contain a DataCount section were rejected while parsing WABT 1.0.42 section output.
inspect_wasm_artifactandrea inspect-wasm-artifactreturnedunreadable_outputwith reasonUnrecognized WABT section row.after validation had already succeeded.WABT right-aligns section names in a 9-column field.
DataCountis 9 characters, so its row has no leading spaces or tabs. The section-row pattern required one or more leading spaces or tabs ([ \t]+). It now allows zero ([ \t]*).Problem and expected behavior
Smallest trigger: compile this module with WABT 1.0.42
wat2wasm --enable-all, then inspect the bytes:wasm-objdump -hprints:That row is legal producer output. REA rejected it before constructing Evidence. Inspection should retain the DataCount section, the rest of the section table, and the decoded WAT. Malformed rows, inconsistent ranges, and a missing section header must still fail.
Change and scope
parseWabtOutputinsrc/wasm/WabtOutput.tsis the owner of this producer text. The only pattern change is[ \t]+to[ \t]*on the section-row regex.Leading whitespace is not what separates the header from section rows:
module.wasm:\tfile format wasm 0x1, a blank line, andSections:.\nSection Details:\n, not on indentation.KIND start=0xHEX end=0xHEX (size=0xHEX)including the space after the size group.No section-kind allowlist was added. Padded unknown kinds were already accepted when the fields and ranges were well formed. Zero padding does not relax those checks.
Not included: a WABT installer, a second parser, or any change to validation flags, Evidence fields, or tool arguments.
Contract and boundary impact
src/wasm/WabtOutput.ts, after successful WABT validation, while parsingwasm-objdumpsection text.inspect_wasm_artifact/inspect-wasm-artifactkeep the same input, output schema, and error categories. Modules that were wrongly rejected now return successful Evidence.wabt-1.0.42-linux-x64binaries. No new host tool is installed by REA.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions inskill-src/and never commit build outputs): none. No catalog, skill, or package metadata change.Evidence and regression coverage
The unit test uses the real WABT 1.0.42 section table for the module above (61 bytes, last section end
0x3d). On the unfixed parser that test throwsUnrecognized WABT section row.The same test then rejects a column-0 row with missing fields, aSections:label in the table, a DataCount row missing the required space after the size, a size that does not match the range, a DataCount start that overlaps the previous section, an artifact length shorter than the last end, and output with the section header removed.The existing golden test still rejects a short artifact, a size/range mismatch, unexpected text before
Section Details, and a DataCount-shaped row that omits the trailing space.src/wasm/WabtOutput.test.ts(unpadded DataCount acceptance plus malformed-output and bad-range rejections).scripts/verify-wasm-artifact.mjscompiles the issue module and requires an unpaddedDataCountheader line and section{ kind: "DataCount", start: 0x23, end: 0x24, bytes: 1, description: "count: 1" }through the compiled CLI and real MCP client.docs/testing.mdmentions that module in the real-WABT lane description.npm run test:focused -- src/wasm/WabtOutput.test.tsfailed the new test withError: Unrecognized WABT section row.atsrc/wasm/WabtOutput.ts:19. The other 3 tests in that file passed, including the extended golden rejection. Realwasm-objdump -hfrom WABT 1.0.42 printed the unpadded DataCount row used by the test.code: unreadable_output,reason: Unrecognized WABT section row.After the fix, the real-WABT lane accepts the module on both CLI and MCP, with the DataCount section above. Case count for that lane is 30 (24 before this module, plus 6 for the new source: CLI/MCP success and the truncated and invalid inputs).verify:wasm:artifactprocess was run on the fixed revision, not rebuilt against the unfixed parser. The unit test is the base reproduction. macOS and Windows WABT binaries were not run.verify:wasm:packagewas not run.For evidence-bearing changes:
Validation performed
Node.js 24.18.0 and npm 11.16.0 (
nvm use 24.18.0). Dependencies fromnpm ci. WABT 1.0.42 linux-x64 from the official release assetwabt-1.0.42-linux-x64.tar.gz, SHA-25684895407a6bbb80e918f33b16b2fb2206021c150b6bc9ff6f761263a745ab131, matching the GitHub release digest.REA_WABT_BIN_DIRECTORY=/tmp/wabt/wabt-1.0.42/bin.npm run test:focused -- src/wasm/WabtOutput.test.tson the unfixed parser -- failed: 1 failed, 3 passed. New test threwUnrecognized WABT section row.npm run test:focused -- src/wasm/WabtOutput.test.tson this revision -- passed: 4 tests.npm run verify:wasm:artifact-- passed:{"status":"passed","cases":30,"tool_profile":"wabt@1.0.42"}.npm run check-- passed: turbo typecheck, lint, format:check, knip, and metadata:check (6 successful); lint reported 0 errors; architecture guards passed across 1151 source files.npm run verify:test-discovery-- passed: discovered all 878 test files exactly once.npm run check:fast-- passed: typecheck and lint, cached.Compatibility, safety, and release
Review checklist
type(scope): outcome.